import {Table,Tag,Button} from "antd";
import {Link} from "react-router-dom";

const columns=[
    {
        title:'题目名称',
        dataIndex:'name',
        key:'name',
        render:(text)=><Link to="/questionMain">{text}</Link>
    },
    {
        title: '题目描述',
        dataIndex: 'content',
        key:'content'
    },
    {
        title:'知识点',
        key:'tags',
        dataIndex: 'tags',
        render:(_,{tags})=>(
            <>
                {tags.map((tag)=>{
                    let color  = tag.length>2?'cyan':'volcano';
                    return(
                        <Tag color={color} key={tag}>
                            {tag}
                        </Tag>
                    );
                })}
            </>
        )
    },
    {
        title: '操作',
        dataIndex: 'options',
        key: 'options',
        render(){
            return(
                <Button type="primary" danger>删除</Button>
            )
        }
    }
]
const data=[
    {
        name:'怎么玩手机',
        content:'这个问题是考你怎么玩手机的',
        tags:['手机','怎么玩'],
    }
]
function Single(){
    return(
        <Table dataSource={data} columns={columns}></Table>
    )
}
export default Single